package define

var (
	// 订单状态：-5-已关闭，-3-已部分退款，-2-已退款，-1-已取消，0-待付款，1-已付款，2-待发货，3-已发货，4-已揽件，5-派件中，6-待评价，7-已完成，8-退款中
	OrderCloseStatus      = -5
	OrderRefundStatus     = -2
	OrderCancelStatus     = -1
	OrderUnpaymentStatus  = 0
	OrderPaymentStatus    = 1
	OrderUnShipmentStatus = 2
	OrderShipmentStatus   = 3
	OrderEvaluateStatus   = 6
	OrderfinishedStatus   = 7
)

/**
 * 获取全部订单状态
 *
 * @return map[string]interface{}
 * @author huwl
 * @date 2025/10/09 11:13:31
 */
func GetAllOrderStatus() []map[string]interface{} {
	return []map[string]interface{}{
		map[string]interface{}{
			"value":     0,
			"value_txt": "待付款",
		},
		map[string]interface{}{
			"value":     1,
			"value_txt": "已付款",
		},
		map[string]interface{}{
			"value":     2,
			"value_txt": "待发货",
		},
		map[string]interface{}{
			"value":     3,
			"value_txt": "已发货",
		},
		map[string]interface{}{
			"value":     4,
			"value_txt": "已揽件",
		},
		map[string]interface{}{
			"value":     5,
			"value_txt": "派件中",
		},
		map[string]interface{}{
			"value":     6,
			"value_txt": "待评价",
		},
		map[string]interface{}{
			"value":     7,
			"value_txt": "已完成",
		},
		map[string]interface{}{
			"value":     8,
			"value_txt": "退款中",
		},
		map[string]interface{}{
			"value":     -1,
			"value_txt": "已取消",
		},
		map[string]interface{}{
			"value":     -2,
			"value_txt": "已退款",
		},
		map[string]interface{}{
			"value":     -3,
			"value_txt": "已部分退款",
		},
		map[string]interface{}{
			"value":     -5,
			"value_txt": "已关闭",
		},
	}
}

/**
 * 获取订单状态
 *
 * @param int status -----------------------必传,订单状态
 * @return map[string]interface{}
 * @author huwl
 * @date 2025/10/09 11:13:31
 */
func GetOrderStatus(status int) map[string]interface{} {
	var orderStatusValue map[string]interface{}
	orderStatusItems := GetAllOrderStatus()
	for _, orderStatusItem := range orderStatusItems {
		if orderStatusItem["value"].(int) == status {
			orderStatusValue = orderStatusItem
			break
		}
	}
	return orderStatusValue
}

/**
 * 获取全部支付渠道
 *
 * @return map[string]interface{}
 * @author huwl
 * @date 2025/10/09 11:13:31
 */
func GetPayChannels() []map[string]interface{} {
	return []map[string]interface{}{
		map[string]interface{}{
			"value":     1,
			"value_txt": "微信",
		},
		map[string]interface{}{
			"value":     2,
			"value_txt": "会员卡",
		},
		map[string]interface{}{
			"value":     3,
			"value_txt": "其他费用抵扣",
		},
		map[string]interface{}{
			"value":     4,
			"value_txt": "支付宝",
		},
		map[string]interface{}{
			"value":     5,
			"value_txt": "其它",
		},
		map[string]interface{}{
			"value":     6,
			"value_txt": "现金余额",
		},
	}
}

/**
 * 获取支付渠道
 *
 * @param int payChannel -------------------必传,支付渠道
 * @return map[string]interface{}
 * @author huwl
 * @date 2025/10/09 11:13:31
 */
func GetPayChannel(payChannel int) map[string]interface{} {
	var payChannelValue map[string]interface{}
	payChannelItems := GetPayChannels()
	for _, payChannelItem := range payChannelItems {
		if payChannelItem["value"].(int) == payChannel {
			payChannelValue = payChannelItem
			break
		}
	}
	return payChannelValue
}

/**
 * 获取全部平台
 *
 * @return map[string]interface{}
 * @author huwl
 * @date 2025/10/09 11:13:31
 */
func GetPlatforms() []map[string]interface{} {
	return []map[string]interface{}{
		map[string]interface{}{
			"value":     1,
			"value_txt": "微信",
		},
		map[string]interface{}{
			"value":     2,
			"value_txt": "Android",
		},
		map[string]interface{}{
			"value":     3,
			"value_txt": "IOS",
		},
		map[string]interface{}{
			"value":     4,
			"value_txt": "PC",
		},
		map[string]interface{}{
			"value":     5,
			"value_txt": "小程序",
		},
	}
}

/**
 * 获取平台
 *
 * @param int platform ---------------------必传,平台
 * @return map[string]interface{}
 * @author huwl
 * @date 2025/10/09 11:13:31
 */
func GetPlatform(platform int) map[string]interface{} {
	var platformValue map[string]interface{}
	platformItems := GetPlatforms()
	for _, platformItem := range platformItems {
		if platformItem["value"].(int) == platform {
			platformValue = platformItem
			break
		}
	}
	return platformValue
}
